package gui.partb;

/**
 *
 *
 * @author guodd
 * @version 1.0 use jdk 1.8
 */
public enum Gender {
    RED("MALE", "M"),
    YELLOW("FEMALE", "F");

    Gender(String name, String index) {
        this.name = name;
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIndex() {
        return index;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    // 成员变量
    private String name;
    private String index;

    public static String getName(String index) {
        for (Gender c : Gender.values()) {
            if (c.getIndex().equals(index)) {
                return c.name;
            }
        }
        return null;
    }
}
